package com.doit.day03

object _03_比较器和可比较的 {
  def main(args: Array[String]): Unit = {


    val orders: List[ScalaOrder] = List(
      ScalaOrder("o001", "sn001", "g001", "c001", 2, 9.9),
      ScalaOrder("o002", "sn002", "g002", "c002", 1, 1400),
      ScalaOrder("o002", "sn003", "g003", "c003", 3, 189),
      ScalaOrder("o002", "sn003", "g005", "c005", 1, 2008),
      ScalaOrder("o003", "sn005", "g004", "c004", 54, 800),
      ScalaOrder("o003", "sn005", "g008", "c008", 3, 356),
      ScalaOrder("o003", "sn005", "g007", "c007", 8, 19.9),
      ScalaOrder("o003", "sn005", "g006", "c006", 1, 39.9)
    )

/*    val list: List[Int] = List(1, 3, 2, 6, 5, 4)

    //隐式方法   比较的东西    这个东西要么是可比较的
    //如果这个东西不是一个可比较的，就需要传一个比较器  只不过这个比较器可以显示的传给他 还可以隐式穿进去
    val sorted: List[ScalaOrder] = orders.sorted

    sorted.foreach(println)*/
    //比较，先按照订单id进行比较，按照他的升序进行排，然后如果订单id相同，在按照价格的降序进行排列

  }

}

case class ScalaOrder(  order_id: String
                        , order_sn: String
                        , goods_id: String
                        , category_id: String
                        , goods_number: Int
                        , price: Double)




